package com.pro.controller;

import com.pro.pojo.JsonData;
import com.pro.pojo.LoginRecord;
import com.pro.service.LoginRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author 谭金诚
 * @Description TODO
 * @Date 2022/1/22 9:52
 * @Version 1.0
 */
@Controller
@RequestMapping("/loginRecord")
public class LoginRecordController {

    @Autowired
    private LoginRecordService service;

    /**
     * @ClassName getLoginRecordTable
     * @Author 谭金诚
     * @Date 2022/1/22
     * @Return List<LoginRecord>
     * 查询登录日志信息
     */
    @RequestMapping("/getLoginRecordTable")
    @ResponseBody
    public JsonData getLoginRecordTable(){
        List<LoginRecord> loginRecordTable = service.getLoginRecordTable();
        return loginRecordTable != null ? JsonData.buildSuccess(loginRecordTable) : JsonData.buildError("服务端错误");
    }

}
